package cn.school.student.dao;

import cn.school.api.bo.StudentBO;
import cn.school.student.entity.StudentInfo;
import cn.school.student.entity.StudentPictureInfo;
import cn.school.student.entity.vo.DeviceStudentExcel;
import cn.school.student.entity.vo.ExamPublishParam;
import cn.school.student.entity.vo.StudentInfoExcel;
import cn.school.student.entity.vo.StudentInfoVo;
import cn.school.student.param.StudentInfoPageParam;
import cn.school.student.vo.StudentContactsImportVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * (TStudentInfo)表数据库访问层
 *
 * @author yuanyuan
 * @since 2022-08-22 08:44:29
 */
@Component
@Mapper
public interface StudentInfoDao extends BaseMapper<StudentInfo> {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    StudentInfo queryById(Long id);

    /**
     * 分页查询:查询总数
     * @param param
     * @return
     */
    int queryCount(StudentInfoPageParam param);

    /**
     * 分页查询:查询分页内容
     * @param param
     * @return
     */
    List<StudentInfo> queryLimit(StudentInfoPageParam param);

    /**
     * 新增数据
     *
     * @param tStudentInfo 实例对象
     * @return 影响行数
     */
    int insert(StudentInfo tStudentInfo);

    /**
     * 修改数据
     *
     * @param tStudentInfo 实例对象
     * @return 影响行数
     */
    int update(StudentInfo tStudentInfo);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 影响行数
     */
    int deleteById(Long id);

    /**
     * 批量插入学生信息
     * @param studentInfoList
     * @return
     */
    int insertStudentInfoBatch(@Param("studentInfoList") List<StudentInfo> studentInfoList);

    /**
     * 查询身份ID是否存在
     * @param list
     * @return
     */
    int findCardIdExists(@Param("list") List<String> list);

    /**
     * 查询学号是否存在
     * @param list
     * @return
     */
    int findStudentIdExists(@Param("list")List<String> list);

    /**
     * 查询手机号是否存在
     * @param list
     * @return
     */
    int findPhoneExists(@Param("list")List<String> list);

    List<StudentInfoVo> queryList(ExamPublishParam examPublishParam);

    Long count(ExamPublishParam examPublishParam);

    /**
     * 批量重置学生密码
     * @author wankeqiu
     * @param: list
     * @updateTime 2023/3/10 11:40
     * @throws
     */
    int batchUpdateStudentsPwd(List<StudentInfo> list);

    /**
     * 批量重置监护人密码
     * @author wankeqiu
     * @param: list
     * @updateTime 2023/3/10 11:48
     * @throws
     */
    int batchUpdateParentsPwd(List<StudentInfo> list);

    /**
     * 查询指定班级中的学生
     * @param list
     * @return
     */
    List<StudentInfoVo> getClassInStudent(@Param("list") List<StudentContactsImportVO> list);

    /**
     * 批量插入学生照片
     * @author alex
     * @param: readList
     * @date 2023/5/19 17:06
     * @return
     */
	int batchUpdateStudentPicture(List<StudentPictureInfo> readList);

    int updateByStudentId(StudentInfo studentInfo);

    List<DeviceStudentExcel> studentByTenantIdList(@Param("tenantId")String tenantId, @Param("studentInfo")StudentInfo studentInfo);

    List<StudentInfoExcel> studentByTenantIdExportList(@Param("tenantId")String tenantId, @Param("studentInfo")StudentInfo studentInfo);

    StudentBO getResultRelateSchoolGate(@Param("studentId")String studentId);

    StudentBO getResultRelateDormitoryCheck(@Param("studentId")String studentId);
}
